package com.simoniu.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;

public class OracleJdbcDemo {

    public static void main(String[] args) {
        String driverClass = "oracle.jdbc.driver.OracleDriver";
        String username = "system";
        String password = "tiger";
        String url = "jdbc:oracle:thin:@localhost:1521:XE";

        Connection conn = null;
        try {
            //加载驱动
            Class.forName(driverClass);
            conn = DriverManager.getConnection(url,username,password);
            if(conn!=null){
                System.out.println("Oracle连接成功！");
            }else{
                System.out.println("Oracle连接失败！");
            }

        }catch(Exception ex){
            ex.printStackTrace();
        }

    }
}
